package com.zlzxm.sorting.ui.view.sortview

import android.R.attr.data
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.chad.library.adapter.base.entity.node.BaseNode
import com.chad.library.adapter.base.provider.BaseNodeProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zlzxm.sorting.R
import com.zlzxm.sorting.globe.dp2px
import com.zlzxm.sorting.globe.picOne


/**
 *
 *CREATE BY zlzxm ON 2022/8/22
 *
 */
class ProductProvider : BaseNodeProvider() {
    override val itemViewType: Int
        get() = 1
    override val layoutId: Int
        get() = R.layout.item_sort_view_product

    override fun convert(helper: BaseViewHolder, item: BaseNode) {
        val entity = item as SecondNode
        Glide.with(context)
            .load(item.face)
            .transform(CenterCrop(),RoundedCorners(dp2px(10f)))
            .into(helper.getView(R.id.ivFace))
        helper.setText(R.id.tvProductName,entity.title)
        helper.setText(R.id.tvProcess,"分拣进度 ${item.process} / ${item.total}")
    }
}